var _ = require('lodash');

// console.log(_);

// lodash 集合 CollectionData
var CollectionData = _.countBy(["o","on","two","four"],"length");

CollectionData = _.every(["o","on","two","four"],String);

CollectionData = _.filter(["o","on","two","four"],(res)=>{
    // console.log(res);
    if (res.length > 2) {
        return res;
    }
});

CollectionData = _.find(["o","on","two","four"],(res)=>{
    // console.log(res);
    if (res.length > 2) {
        return res;
    }
});

CollectionData = _.flatMap(["o","on","two","four"],(res)=>{
    // console.log(res);
    if (res.length > 2) {
        return res+"flatMap";
    }else{
        return res;
    }
});

CollectionData = _.groupBy(["o","on","two","four"],"length");
CollectionData = _.includes(["o","on","two","four"],"o");

CollectionData = _.sample(["o","on","two","four"]);
CollectionData = _.sampleSize(["o","on","two","four"],2);

// lodash 数组 数组
CollectionData = [1,2,null,false,"",undefined,3];
CollectionData = _.compact(CollectionData);
CollectionData = _.uniq(["o","on","two","four","o"]);

console.log(CollectionData);   

var fillAry = [1,2,3,4,[[[[[[[[[[[[[33]]]]]]]]]]]]]];
_.fill(fillAry,"wjy",1,3);

console.log(fillAry);
console.log(_.flattenDeep(fillAry));   
console.log(_.head(fillAry));   
console.log(_.pull(fillAry,3));   
console.log(_.slice(fillAry,1,3));
console.log(fillAry.slice(1,3));
console.log(_.sortedIndexOf(fillAry,1));
console.log(fillAry);



// _.defer((stamp)=>{
//     console.log(_.now());
//     console.log(stamp);
//     console.log(_.now() - stamp);
// },_.now())

//函数
var saves = ['profile', 'settings'];
 


console.log(_.map([1,1.1,2,2.2],_.ary(parseInt,1)));

function test(){
    console.log(123);
}

var onceFun = _.once(test);

onceFun();

var takeAry = [1,2,3,4,5,6,7,8];
let takeVal = _.take(takeAry,3);


let withoutAry = [{name:123,age:222},{name:1,age:1}];
let withoutVal = _.without(withoutAry,{name:1,age:1});
console.log(withoutAry);
console.log(withoutVal);
